package com.zj.study;

import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;

public class 基本计算器3加减乘除含括号 {

    public static void main(String[] args) {
        String aa = "1+2*(1+2)+4/2";
        System.out.println(calculate(aa));
    }


    public static int calculate(String s) {

        String[] split = s.split("[+\\-*/]");
        System.out.println(Arrays.asList(split));
        Deque<Character> opQue1 = new ArrayDeque<>();
        Deque<Character> opQue2 = new ArrayDeque<>();

        Deque<String> numeQue = new ArrayDeque<>();
        int index = 0;
        for (int i = 0; i < split.length; i++) {
            if (split[i].startsWith("(")) {
                numeQue.push(split[i]);
            }
            if (split[i].startsWith(")")) {
            }
            index += split[i].length() + 1;
            if (isOpt1(s.charAt(index))) {
                opQue1.push(s.charAt(index));
            } else {

            }

        }
        return 0;

    }

    public static boolean isOpt1(char ch) {
        return ch == '+' || ch == '-';
    }

    public static boolean isOpt2(char ch) {
        return ch == '*' || ch == '/';
    }

    public static int compute(int a, int b, char operator) {
        switch (operator) {
            case '+':
                return a + b;
            case '-':
                return a - b;

            case '*':
                return a * b;
            case '/':
                return a / b;


        }
        return 0;


    }
}
